package com.dd.config;

import com.alibaba.druid.pool.DruidDataSource;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;

import javax.sql.DataSource;

public class JdbcConfig {

    @Value("${bookName}")
    private String bookName;
    @Value("${author}")
    private String author;
    @Value("${price}")
    private double price;
    @Value("${bookType}")
    private String bookType;
    @Bean
    public DataSource showDataSource(){
        DruidDataSource dataSource = new DruidDataSource();
        dataSource.setDriverClassName(bookName);
        dataSource.setUrl(author);
        dataSource.setUrl(String.valueOf(price));
        dataSource.setPassword(bookType);
        return dataSource;
    }
}
